Import("reduce_scons_env", "env_etc")

env = reduce_scons_env.Clone()
env.Append(
  CXXFLAGS=[
    "-DAROMATICS_ACCEPT_HBONDS",
    "-DCHARFUNCMACROS",
    "-DBOOLPREDEFINED",
    "-DBRACKETOPERPARMS",
    "-DLEFT_JUSTIFY_NUC_RES_OK",
    "-DLISTFRIENDFIX",
    "-DINCTEMPLATEDEFNS"])
if (env_etc.compiler != "win32_cl"):
  env.Append(CXXFLAGS=[
    """-DHET_DICTIONARY='"/usr/local/reduce_wwPDB_het_dict.txt"'""",
    """-DHET_DICTOLD='"/usr/local/reduce_het_dict.txt"'""",
    "-std=c++11"]
  )
env.Append(CPPPATH=["#reduce/toolclasses", "#reduce/libpdb"])
env.Append(LIBPATH=["#reduce/lib"])
env.StaticLibrary(
  target=["#reduce/lib/reducelib"],
  source=[
    "hybrid_36_c.c",
    "GraphToHoldScores.cpp",
    "reduce.cpp",
    "CTab.cpp",
    "ElementInfo.cpp",
    "StdResH.cpp",
    "ResBlk.cpp",
    "AtomConn.cpp",
    "AtomPositions.cpp",
    "DotSph.cpp",
    "Mover.cpp",
    "Rot.cpp",
    "Rot3Fold.cpp",
    "RotDonor.cpp",
    "FlipMemo.cpp",
    "CliqueList.cpp",
    "AtomDescr.cpp",
    "PDBrec.cpp",
    "MoveableNode.cpp",
    "RotAromMethyl.cpp"])
env.Prepend(LIBS=["reducelib", "toolclasses", "pdb++"])
exe = env.Program(
  target=["#reduce/exe/reduce"],
  source=[
    "main.cpp"])

if (not env_etc.no_boost_python):
  Import("env_cctbx_boost_python_ext")
  env_bpl = env_cctbx_boost_python_ext.Clone()
  env_bpl.Append(
    SHCXXFLAGS=[
      "-DAROMATICS_ACCEPT_HBONDS",
      "-DCHARFUNCMACROS",
      "-DBOOLPREDEFINED",
      "-DBRACKETOPERPARMS",
      "-DLEFT_JUSTIFY_NUC_RES_OK",
      "-DLISTFRIENDFIX",
      "-DINCTEMPLATEDEFNS",
      "-std=c++11"])
  if (env_etc.compiler != "win32_cl"):
    env.Append(SHCXXFLAGS=[
      """-DHET_DICTIONARY='"/usr/local/reduce_wwPDB_het_dict.txt"'""",
      """-DHET_DICTOLD='"/usr/local/reduce_het_dict.txt"'""",
      "-std=c++11"]
    )
  env_bpl.Append(CPPPATH=["#reduce/toolclasses", "#reduce/libpdb"])
  env_bpl.Append(LIBPATH=["#reduce/lib"])
  env_bpl.Prepend(LIBS=["reducelib", "toolclasses", "pdb++"])
  env_bpl.SharedLibrary(
    target="#lib/mmtbx_reduceOrig_ext",
    source=["reduce_bpl.cpp"
            ])

